-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Make Custom menus scrollable #11425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Custom menus scrollable #11425
Conversation
Fixes arduino#11416 The patch on MenuScroller.java is needed to avoid a clash between custom menus with the same label. This behaviour artificially increases the amount of objects that the scroller will calculate. Eg. if two boards share the same custom menu, that menu will contain the properties for both the boards (since it's parsed twice).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, so the problem is indeed the invisible items. I haven't tested, but I wonder if the filter you added is in the right place? AFAICS this now ensures that menuItems
omits the invisible items, but restoreItems
clears all items, including invisible ones and then restores all items in menuItems
, so that restores only the visible ones? If this is indeed the case, I suspect that switching between boards might prevent showing items for the second board that did not exist for the first board?
Shouldn't setMenuItems
still backup the full list and then have refreshMenu
operate on the visible list? In practice, that could be done by modifying the loops in refreshMenu
to skip invisible items (or use streaming functions to simplify that, mabye), or a lot simpler, by letting setMenuItems
create two lists: One list with all items for restoration and one list with visible items for use in refreshMenu
?
@matthijskooijman you are indeed (as always 🙂 ) right, but for some unknown reason I'm unable to trigger the expected wrong behaviour. |
Hm, I haven't tried reproducing it (and no time to dig in, I'm afraid). Maybe just apply a fix and not worry about reproducing the problem, though? :-) |
@matthijskooijman I've pushed a fix for the issue you described, the only way I managed to reproduce is this way:
All the other platforms ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me. I played around with the latest STM32 core a bit and it seems to work as expected.
Thanks a lot @facchinm, @cmaglie and @matthijskooijman |
Fixes #11416
The patch on MenuScroller.java is needed to avoid a clash between custom menus with the same label.
This behaviour artificially increases the amount of objects that the scroller will calculate.
Eg. if two boards share the same custom menu, that menu will contain the properties for both the boards (since it's parsed twice).
All Submissions:
New Feature Submissions:
Changes to Core Features: